package po;

import java.io.Serializable;
import java.util.ArrayList;


public class FavoritePO implements Serializable{
	private static final long serialVersionUID = 1L;
	private ArrayList<BookPO> bookList;
	
	public FavoritePO() {
		bookList=new ArrayList<BookPO>();
	}
	
	public ResultMessage addBook(BookPO book){
		for (int i = 0; i < bookList.size(); i++) {
			if(bookList.get(i).isSame(book)){
				return ResultMessage.ERROR;
			}
		}
		
		bookList.add(book);
		return ResultMessage.SUCCEED;
	}

	public void delete(BookPO book) {
		bookList.remove(book);
	}

	public ArrayList<BookPO> getFavouriteBooks() {
		return bookList;
	}
}
